using GolSig.Library;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Test.GolSig.Library.GridStorageSpecs
{
    [TestClass()]
    public class WhenCheckingCellAlive
    {
        [TestMethod()]
        public void GivenValidConditions_ShouldGiveStatusInfoBack()
        {
            GridSize gridSize = new GridSize(3, 3);
            GridStorage target = new GridStorage(gridSize);
            GridPosition gridPosition = new GridPosition(new Position(1, 1));
            target.SetCellData(gridPosition, true);

            var actual = target.IsCellAlive(gridPosition);
            Assert.AreEqual(true, actual);

        }


        [TestMethod(), ExpectedException(typeof(System.ArgumentOutOfRangeException))]
        public void GivenOutOfBoundGridPositon_ShouldRaiseException()
        {
            GridSize gridSize = new GridSize(3, 3);
            GridStorage target = new GridStorage(gridSize);
            GridPosition gridPosition = new GridPosition(new Position(1, 1));
            target.SetCellData(gridPosition, true);

            var actual = target.IsCellAlive(new GridPosition(new Position(4, 4)));

            Assert.Fail("expected exception");

        }
    }
}
